home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / tex / cut_past.zip / CUT.MAN < prev    next >
Text File  |  1987-03-05  |  4KB  |  133 lines

  1.  
  2.  
  3.  
  4. CUT(1)              UNIX Programmer's Manual               CUT(1)
  5.  
  6.  
  7.  
  8. NAME
  9.      cut - cut out selected fields of each line of a file
  10.  
  11. SYNOPSIS
  12.      cut -clist [file1 file2 ...]
  13.      cut -flist [-dchar] [-s] [file1 file2 ...]
  14.  
  15. DESCRIPTION
  16.      Use _c_u_t to cut out columns from a table or fields from each
  17.      line of a file; in data base parlance, it implements the
  18.      projection of a relation.  The fields as specified by _l_i_s_t
  19.      can be fixed length, i.e., character positions as on a
  20.      punched card (-c option) or the length can vary from line to
  21.      line and be marked with a field delimiter character like _t_a_b
  22.      (-f option).  _C_u_t can be used as a filter; if no files are
  23.      given, the standard input is used.
  24.  
  25.      The meanings of the options are:
  26.  
  27.      _l_i_s_t     A comma-separated list of integer field numbers,
  28.               with optional - to indicate ranges as in the -o
  29.               option of _n_r_o_f_f/_t_r_o_f_f for page ranges; e.g., 1,4,7;
  30.               1-3,8; -5,10 (short for 1-5,10); or 3- (short for
  31.               third through last field).
  32.  
  33.      -c_l_i_s_t   The _l_i_s_t following -c specifies character positions
  34.               (e.g., -c1-72 would pass the first 72 characters of
  35.               each line).
  36.  
  37.      -f_l_i_s_t   The _l_i_s_t following -f is a list of fields assumed
  38.               to be separated in the file by a delimiter charac-
  39.               ter (see -d ); e.g., -f1,7 copies the first and
  40.               seventh field only.  Lines with no field delimiters
  41.               will be passed through intact (useful for table
  42.               subheadings), unless -s is specified.
  43.  
  44.      -d_c_h_a_r   The character following -d is the field delimiter
  45.               (-f option only).  Default is _t_a_b.  Space or other
  46.               characters with special meaning to the shell must
  47.               be quoted.
  48.  
  49.      -s       Suppresses lines with no delimiter characters in
  50.               case of -f option.  Unless specified, lines with no
  51.               delimiters will be passed through untouched.
  52.  
  53.      Either the -c or -f option must be specified.
  54.  
  55. HINTS
  56.      Use _g_r_e_p(1) to make horizontal ``cuts'' (by context) through
  57.      a file, or _p_a_s_t_e(1) to put files together column-wise (i.e.,
  58.      horizontally).  To reorder columns in a table, use _c_u_t and
  59.      _p_a_s_t_e.
  60.  
  61.  
  62.  
  63. Printed 3/5/87                                                  1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. CUT(1)              UNIX Programmer's Manual               CUT(1)
  71.  
  72.  
  73.  
  74. EXAMPLES
  75.      cut -d: -f1,5 /etc/passwd
  76.                            mapping of user IDs to names
  77.  
  78.      name=`who am i | cut -f1 -d" "`
  79.                            to set name to current login name.
  80.  
  81. DIAGNOSTICS
  82.      Error messages may come from getopt(3). All error messages
  83.      contain limits for line and field lenghts.
  84.  
  85. SEE ALSO
  86.      grep(1), paste(1).  getopt(3)
  87.  
  88.  
  89.  
  90.  
  91.  
  92.  
  93.  
  94.  
  95.  
  96.  
  97.  
  98.  
  99.  
  100.  
  101.  
  102.  
  103.  
  104.  
  105.  
  106.  
  107.  
  108.  
  109.  
  110.  
  111.  
  112.  
  113.  
  114.  
  115.  
  116.  
  117.  
  118.  
  119.  
  120.  
  121.  
  122.  
  123.  
  124.  
  125.  
  126.  
  127.  
  128.  
  129. Printed 3/5/87                                                  2
  130.  
  131.  
  132.  
  133.